﻿using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using LearnTodo.Models;

namespace LearnTodo.Views;

public partial class AddTodoDialog : UserControl
{
    public AddTodoDialog()
    {
        InitializeComponent();
    }

    public TodoModel? Done()
    {
        if (string.IsNullOrEmpty(NameBox.Text) || Picker.SelectedDate == null) return default;
        return new TodoModel()
            { Name = NameBox.Text, End = Picker.SelectedDate.Value, Description = DescriptionBox.Text };
    }
}